﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.UI.Selection;

namespace YArchitech.HVAC
{
	public class PipeAndSprinklersSelectionFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is Pipe)
			{
				PipeSystemType systemType = ((elem as Pipe).MEPSystem as PipingSystem).SystemType;
                if ((int)systemType == 23 || (int)systemType == 25)
				{
					return true;
				}
			}
			else if (elem is FamilyInstance && elem.Category.Id.IntegerValue == -2008099)
			{
				return true;
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			return false;
		}
	}
}
